package chapter2.No2_2_synchronized同步语句块.n内置类与同步_实验1;

import chapter2.No2_2_synchronized同步语句块.n内置类与同步_实验1.PublicClass.PrivateClass;

/**
 * *：因为锁对象不同，一个是string的锁，一个是对象的锁，所以会出现异步
 * Created by Administrator on 2016/11/14.
 */
public class Main {

    public static void main(String[] args) {
        final PrivateClass privateClass = new PrivateClass();

        Thread a = new Thread(new Runnable() {
            public void run() {
                privateClass.methodA();
            }
        },"A");

        Thread b = new Thread(new Runnable() {
            public void run() {
                privateClass.methodB();
            }
        },"B");

        a.start();
        b.start();
    }

}
